package com.vodone.v1pin.userInfo.delegate
{
	import com.vodone.v1pin.ServiceProvider;
	import com.vodone.v1pin.core.model.MainModelLocator;
	import com.vodone.v1pin.core.service.HttpJsonDelegate;
	
	import mx.rpc.http.mxml.HTTPService;

	public class AddressDelegate
	{
		public static function getAddressList( resultHandler:Function , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getAddressService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		/**
		 * 需要添加收货地址 ID
		 * */
		public static function editAddressList( resultHandler:Function , addressID:String , name:String , provinceCode:String , cityCode:String , areaCode:String , address:String , postCode:String , mobile:String , phone:String , isDefault:String , flag:String ,  faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().editAddressService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId,
				addressID : addressID,
				name : name,
				provinceCode : provinceCode,
				cityCode : cityCode,
				areaCode : areaCode,
				address : address,
				postCode : postCode,
				mobile : mobile,
				phone : phone,
				isDefault : isDefault,
				flag : flag
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function deleteMessage( resultHandler:Function , id:String , type:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().deleteMessageService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId,
				id : id,
				type : type
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function getAddressTime( resultHandler:Function , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getAddressTimeService;
			var params:Object = {
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
	}
}